<table>
    <tr>
        <td colspan="5">
            <?php echo $this->element('excel/title'); ?>
        </td>
        <td colspan="6">
            <table>
                <tr>
                    <td colspan="6" class="docNote">VMI: PRODUCT INVENTORY</td>
                </tr>
                <tr>
                    <td><label>Printed Date</label></td>
                    <td><?php echo date('d/m/Y H:i'); ?></td>
                    <td><label>Page</label></td>
                    <td><span class="pageNo">1/1</span></td>
                </tr>
                <tr>
                    <td><label>Printed by</label></td>
                    <td colspan="3"><?php echo $report_by; ?></td>
                </tr>
                <?php if ($session->check('Criteria.customer')) {
                ?>
                    <tr>
                        <td><label>Customer</label></td>
                        <td colspan="3"><?php echo $session->read('Criteria.customer'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.site')) {
                ?>
                    <tr>
                        <td><label>Site</label></td>
                        <td colspan="3"><?php echo $session->read('Criteria.site'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.supplier_name')) {
                ?>
                    <tr>
                        <td><label>Vendor</label></td>
                        <td colspan="3"><?php echo $session->read('Criteria.supplier_name'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.brand_name')) {
                ?>
                    <tr>
                        <td><label>Brand</label></td>
                        <td colspan="3"><?php echo $session->read('Criteria.brand_name'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.category_name')) {
                ?>
                    <tr>
                        <td><label>Category</label></td>
                        <td colspan="3"><?php echo $session->read('Criteria.category_name'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.part_no')) {
                ?>
                    <tr>
                        <td><label>Vendor Part no.</label></td>
                        <td colspan="3"><?php echo $session->read('Criteria.part_no'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.model')) {
                ?>
                    <tr>
                        <td><label>Model</label></td>
                        <td colspan="3"><?php echo $session->read('Criteria.model'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.title')) {
                ?>
                    <tr>
                        <td><label>Title</label></td>
                        <td colspan="3"><?php echo $session->read('Criteria.title'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.text')) {
                ?>
                    <tr>
                        <td><label>Description</label></td>
                        <td colspan="3"><?php echo $session->read('Criteria.text'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.current_stock')) {
                ?>
                    <tr>
                        <td><label>Current Stock</label></td>
                        <td colspan="3"><?php echo $session->read('Operand.current_stock') . ' ' . $session->read('Criteria.current_stock'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.latest_cost_start')) {
                ?>
                    <tr>
                        <td><label>Lastest Cost</label></td>
                        <td colspan="3">From <?php echo number_format($session->read('Criteria.latest_cost_start')); ?> To <?php echo number_format($session->read('Criteria.latest_cost_end')); ?> Baht</td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.latest_price_start')) {
                ?>
                    <tr>
                        <td><label>Lastest Price</label></td>
                        <td colspan="3">From <?php echo number_format($session->read('Criteria.latest_price_start')); ?> To <?php echo number_format($session->read('Criteria.latest_price_end')); ?> Baht</td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.last_stock_in_date_start')) {
                ?>
                    <tr>
                        <td><label>Last Stock in Date</label></td>
                        <td colspan="3">From <?php echo $session->read('Criteria.last_stock_in_date_start'); ?> To <?php echo $session->read('Criteria.last_stock_in_date_end'); ?></td>
                    </tr>
                <?php } ?>
                <?php if ($session->check('Criteria.last_stock_out_date_start')) {
                ?>
                    <tr>
                        <td><label>Last Dispatch Date</label></td>
                        <td colspan="3">From <?php echo $session->read('Criteria.last_stock_out_date_start'); ?> To <?php echo $session->read('Criteria.last_stock_out_date_end'); ?></td>
                    </tr>
                <?php } ?>
            </table>
        </td>
    </tr>
</table>

<div class="main">
    <table id="dataTable" class="dataTable" cellspacing="0" cellpadding="0" >
        <thead id="tableHead">
            <tr>
                <th class="no">No</th>
                <th width="130px">Part No.</th>
                <th>Category</th>
                <th>Brand</th>
                <th>Title</th>
                <th>Model</th>
                <th width="80px">Current Stock</th>
                <th width="60px">Amount</th>
            </tr>
        </thead>
        <tbody id="tableBody">
            <?php
            foreach ($this->data as $i => $data) :
            ?>
                <tr class="row">
                    <td class="center rowTd"><?php echo $i + 1; ?></td>
                    <td><?php echo $data['Product']['part_no']; ?></td>
                    <td><?php echo $data['Category']['name']; ?></td>
                    <td><?php echo $data['Brand']['name']; ?></td>
                    <td><?php echo $data['Product']['title']; ?></td>
                    <td><?php echo $data['Product']['model']; ?></td>
                    <td class="text-right"><?php echo $data['Product']['current_stock']; ?></td>
                    <td class="text-right"><?php echo number_format($data['Product']['current_stock'] * $data['Product']['price']); ?></td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>

<div class="footer"></div>

<div id="divLastFooter">
</div>
